1 /* 2 Copyright: Marcelo S. N. Mancini (Hipreme|MrcSnm), 2018 - 2021 3 License: [https://creativecommons.org/licenses/by/4.0/|CC BY-4.0 License]. 4 Authors: Marcelo S. N. Mancini 5 6 Copyright Marcelo S. N. Mancini 2018 - 2021. 7 Distributed under the CC BY-4.0 License. 8 (See accompanying file LICENSE.txt or copy at 9 https://creativecommons.org/licenses/by/4.0/ 10 */ 11 module hip.config.renderer; 12 13 version(Android) enum UseGLES = true; 14 else version(PSVita) enum UseGLES = true; 15 else version(WebAssembly) enum UseGLES = true; 16 else enum UseGLES = false; 17 18 version(OpenGL) enum HasOpenGL = true; 19 else enum HasOpenGL = false; 20 21 version(AppleOS) enum HasMetal = true; 22 else enum HasMetal = false; 23 24 version(Direct3D_11) enum HasDirect3D = true; 25 else enum HasDirect3D = false; 26 27 version(PSVita) enum GLMaxOneBoundTexture = true; 28 else version(WebAssembly) enum GLMaxOneBoundTexture = true; 29 else version(Android) enum GLMaxOneBoundTexture = true; 30 else enum GLMaxOneBoundTexture = false; 31 32 33 /** 34 * HipRenderer implements a delayed unbinding. That means it will only unbind a resource when trying to bind 35 * another resource 36 * This works for both OpenGL and Direct3D 11. 37 * But does not work for metal, since the render pipeline state can't be reused between frames. 38 */ 39 enum UseDelayedUnbinding = !HasMetal; 40 41 /** 42 * This can provide a reduced memory usage for sprites which can also be a big win for other platforms. You may increase that amount but can't surpass index_t.max / 4 43 */ 44 enum DefaultMaxSpritesPerBatch = 1024; 45 // enum DefaultMaxSpritesPerBatch = 10922; 46 // enum DefaultMaxGeometryBatchVertices = ushort.max; 47 enum DefaultMaxGeometryBatchVertices = 8_192; 48 49 50 51 52 /** 53 * On WebGL, there's not much point in disabling them. 54 */ 55 version(WebAssembly) enum GLShouldDisableVertexAttrib = false; 56 else enum GLShouldDisableVertexAttrib = true; 57 58 enum GLMaxVertexAttributes = 64; 59 60 61 62 63 pragma(LDC_no_typeinfo) 64 struct HipRendererConfig 65 { 66 ///Use level 0 for pixel art games 67 ubyte multisamplingLevel = 0; 68 ///Single/Double/Triple buffering 69 ubyte bufferingCount = 2; 70 bool isMatrixRowMajor = true; 71 bool fullscreen = false; 72 bool vsync = true; 73 }